package xhwl.hmo.mall.http.api;


import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.Constant;
import xhwl.hmo.mall.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/1/16.
 */

public class CheckUpgradeApi extends BaseApi {
    UpgradeReq req;
    public CheckUpgradeApi(){
        this(false,true);
    }
    public CheckUpgradeApi(boolean showDialog,boolean cancle){
        req=new UpgradeReq();
        setShowDialog(showDialog);
        setCancle(cancle);
    }
    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).checkUpgrade(requestBody);
    }
    public static class UpgradeReq {
        private String client_type;
        public UpgradeReq(){
            this.client_type= Constant.CLIENT_TYPE;
        }
    }
}
